<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script src="/javascript/jquery.alerts.js" type="text/javascript"></script>
<link href="/stylesheets/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />

<script type="text/javascript">

		 // JQuery Code
		$(document).ready(function() {
			$('#compform').submit(function() {
				res=ValidateForm()
				if (res==0) {
					jAlert("Title can not be empty and must be less than {{ maxTitleLength }} chars long and in English/numbers", "Attention");
					return false;
				}
				else if (res==-1) {
					jAlert("Please insert valid entry amount", "Attention");
					return false;
				}
					
				else return true;
			});
			return false;
		});

		function ValidateForm() {
			if ($('#title').val()=='' || $('#title').val().search(/[^a-zA-Z0-9 ]/g) != -1 || $('#title').val().length>{{ maxTitleLength }}) return 0;
			else if ($('#amount').val()=='' || $('#amount').val()!=parseInt($('#amount').val())) return -1;
			
			
			return 1;
		}



</script> 